package com.situ.mall.design.observer;




public class Reader implements Observer{
    private String name;

    public Reader(String name) {
        this.name = name;
    }


    /**
     * update传入目标对象Subject，如果需要目标对象的属性或者方法直接调用
     * @param subject
     */
    @Override
    public void update(Subject subject) {
        String content = ((NewsPaper) subject).getContent();
        System.out.println(name +"收到报纸，报纸内容是： " + content);
    }
}
